package com.qf.service.impl;

import com.qf.dao.FeeDao;
import com.qf.pojo.Fee;
import com.qf.pojo.Order;
import com.qf.pojo.resp.BaseResult;
import com.qf.service.FeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FeeServiceImpl implements FeeService {
    BaseResult baseResult = new BaseResult();
    @Resource
    FeeDao feeDao;

    @Override
    public BaseResult findByUid(Integer uid) {
        Fee fee = feeDao.findById(uid);
        if (fee!=null){
            baseResult.setCode(1);
            baseResult.setData(fee);
            System.out.println(baseResult);
            return baseResult;
        }
        baseResult.setCode(0);
        return baseResult;
    }




    @Override
    public BaseResult updateWaterMoney(Order order) {
        try {
            feeDao.updateWaterMoney(order);
            return new BaseResult(1,"支付成功!!!",null);
        } catch (Exception e) {
            e.printStackTrace();
            return new BaseResult(1,"支付失败!!!",null);
        }
    }


    @Override
    public BaseResult updateDianMoney(Order order) {
        try {
            feeDao.updateDianMoney(order);
            return new BaseResult(1,"支付成功!!!",null);
        } catch (Exception e) {
            e.printStackTrace();
            return new BaseResult(1,"支付失败!!!",null);
        }
    }
}
